// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import "./utils/gw/initMethods";
import Vue from 'vue';
import App from './App';
//import router from './router';
import store from './store';
// import {showLoading, hideLoading, ins} from "./utils/loading";
import initConfigParams from "./utils/settings/initStartParams/initInterface";
import "./lib/publish-subscription";
import "./utils/settings/initPostMessageReceiveEvent";
import { getUserInfo } from "./utils/settings/getUserInfo";
import sdrag from "./utils/Drag";
import scter from "./utils/DragContainers";
import VueLazyload from 'vue-lazyload';
import initRouter from "./utils/settings/initRouter";
import setRouterLifeCycle from "./utils/setRouterLifeCycle";
Vue.use(VueLazyload, {
	loading: 'static/image/demo1.png',
	error: 'static/image/demo2.png',
});
Vue.use(sdrag);
Vue.use(scter);

Vue.config.productionTip = false;

function shopIsClosed(state) {
	return !state;
}

async function init() {
	// await initInterface;
	let state = await initConfigParams();
	await getUserInfo();
	console.log("初始化完参数");
	// console.log("await initConfigParams--->window.manifest", window.manifest);
	// let state = await getConfigParams();
	let router = await initRouter(shopIsClosed(state));
	// console.log("请求到的配置参数", JSON.parse(sessionStorage.getItem("configParams")));
	new Vue({
		el: '#app',
		router,
		store,
		template: '<App/>',
		components: { App }
	});
	/*hideLoading();*/
}
init();

// (async function init() {
// 	await initConfigParams();
// 	await getUserInfo();
// 	// let router = (await import("./router")).default;
// 	let router = await initRouter(shopIsClosed(state));
// 	setRouterLifeCycle(router);
// //	console.log("router->>>", router);
// //   await Promise.all([initConfigParams, getUserInfo]);
// 	new Vue({
// 		el: '#app',
// 		router,
// 		store,
// 		components: { App },
// 		template: '<App/>'
// 	})
// })();
